﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Workflow.IService;
using Workflow.IService.Menu;
using Workflow.Model;
using Workflow.Web.Common;
using Workflow.Web.Models;
using Workflow.Resource;

namespace Workflow.Web.Controllers
{
    [HandleError]
    [Localization]
    [UserAuthorize]
    public class HomeController : Controller
    {
        public IUserTree UserTree { get; set; }
     
        public ActionResult Index() 
        {

            ViewData["Message"] = "Welcome to ASP.NET MVC!";
            return View();
        }
		public ActionResult Index1()
		{
			return View();
		}
        public ActionResult About()
        {
            return View();
        }
        public ActionResult Welcome()
        {
            return View();
        }
        public ActionResult Tree()
        {
            int groupcode = int.Parse(Session[ConfigReader.AuthorizeSessionUserGroupCode].ToString());
            int rolecode = int.Parse(Session[ConfigReader.AuthorizeSessionUserRoleCode].ToString());
            JsonMenus jsonMenus = UserTree.GetUserTree(groupcode,rolecode);
            return this.Json(jsonMenus, JsonRequestBehavior.AllowGet);
         
        }
        public ActionResult ChangeLang() {
            if ((LangType)Session["Lang"] == LangType.en) {
                Session["Lang"] = LangType.cn;
            }
            else {
                Session["Lang"] = LangType.en;
            }
            return View("Index");
           
        }
    }
    }
 
